var t = getApp();

Page({
    data: {
        page: 1,
        isLoadMore: !0,
        total_page: 0,
        listData: [],
        networkLoading: !1,
        circleId: 0,
        searchText: ""
    },
    onLoad: function(t) {
        this.data.circleId = t.circleId, this.getListData();
    },
    initData: function() {
        this.setData({
            page: 1,
            total_page: 0,
            isLoadMore: !0,
            networkLoading: !1
        });
    },
    getListData: function() {
        var a = this;
        this.initData();
        var e = t.getNetAddresss("plugin.circle.frontend.circle-member.get-circle-memberList"), i = {
            nickname: this.data.searchText,
            circle_id: this.data.circleId,
            is_review: 1
        };
        t._postNetWork({
            url: e,
            data: i,
            success: function(e) {
                var i = e.data;
                if (1 != i.result) return t.tips(i.msg);
                a.data.total_page = i.data.last_page, a.data.total_page || (a.data.total_page = 0), 
                a.setData({
                    listData: i.data.data,
                    networkLoading: !0
                });
            }
        });
    },
    _getMoreData: function() {
        var a = this;
        if (this.data.isLoadMore = !1, !(this.data.page >= this.data.total_page)) {
            this.data.page += 1;
            var e = t.getNetAddresss("plugin.circle.frontend.circle-member.get-circle-memberList"), i = {
                nickname: this.data.searchText,
                page: this.data.page,
                circle_id: this.data.circleId,
                is_review: 1
            };
            t._postNetWork({
                url: e,
                data: i,
                success: function(t) {
                    var e = t.data;
                    if (a.data.isLoadMore = !0, 1 === e.result) {
                        var i = a.data.listData.concat(e.data.data);
                        a.setData({
                            listData: i
                        });
                    } else a.data.page = a.data.page - 1, a.data.isLoadMore = !1;
                }
            });
        }
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    delMember: function(t) {
        var a = this, e = t.currentTarget.dataset.index, i = t.currentTarget.dataset.item;
        wx.showModal({
            title: "是否删除该会员",
            success: function(t) {
                console.log(t), t.confirm ? (console.log("点击确定"), a.pushDelMember(i.id, e)) : t.cancel && console.log("用户点击取消");
            }
        });
    },
    pushDelMember: function(a, e) {
        var i = this, s = t.getNetAddresss("plugin.circle.frontend.circle.delete-circle-member");
        t._postNetWork({
            url: s,
            data: {
                circle_id: this.data.circleId,
                member_id: a
            },
            success: function(a) {
                var s = a.data;
                if (1 != s.result) return t.tips(s.msg);
                var r = i.data.listData;
                r.splice(e, 1), i.setData({
                    listData: r
                });
            }
        });
    },
    onReachBottom: function() {},
    onShareTimeline: function() {},
    onShareAppMessage: function() {}
});